//
//  BottomJieSuanView.m
//  JiuJiuShangCheng
//
//  Created by jiujiukeji on 2018/7/5.
//  Copyright © 2018年 jiujiukeji. All rights reserved.
//

#import "BottomJieSuanView.h"

@implementation BottomJieSuanView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setUpUI];
    }
    return self;
}
- (void)setUpUI
{
    WeakSelf
    self.selectAllBtn = [UIButton buttonWithTitle:@" 全选" fontSize:16 titleColor:UIColorFromRGB(0x666666) background:kClearColor cornerRadius:0];
    [self.selectAllBtn setImage:UIImageNamed(@"shemoren") forState:(UIControlStateNormal)];
    [self addSubview:_selectAllBtn];
    [_selectAllBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self);
        make.centerY.equalTo(self);
        make.size.mas_offset(CGSizeMake(rateWidth(160), rateHeight(90)));
    }];
    
    self.jieSuanBtn = [UIButton buttonWithTitle:@"结算" fontSize:16 titleColor:UIColorWhite background:navBarColor cornerRadius:0];
    [self addSubview:_jieSuanBtn];
    [_jieSuanBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_offset(CGSizeMake(rateWidth(200), rateHeight(100)));
        make.right.equalTo(self);
        make.centerY.equalTo(self);
    }];
    
    self.priceLB = [UILabel labelWithText:@"￥0.00" textColor:UIColorWithRGB(243, 58, 58) fontSize:15];
    [self.priceLB sizeToFit];
    [self addSubview:_priceLB];
    [_priceLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(weakSelf.jieSuanBtn.mas_left).offset(-rateWidth(20));
        make.centerY.equalTo(self);
    }];
    
    self.sumLB = [UILabel labelWithText:@"合计：" textColor:UIColorFromRGB(0x333333) fontSize:15];
    [_sumLB sizeToFit];
    [self addSubview:_sumLB];
    [_sumLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(weakSelf.priceLB.mas_left);
        make.centerY.equalTo(self);
    }];
    
    UIView *line1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth-rateWidth(200), 1)];
    line1.backgroundColor = UIColorWithRGB(230, 230, 230);
    [self addSubview:line1];
    
    UIView *line2 = [[UIView alloc] init];
    line2.backgroundColor = UIColorWithRGB(230, 230, 230);
    [self addSubview:line2];
    [line2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.equalTo(self);
        make.height.equalTo(@(1));
        make.width.equalTo(@(kScreenWidth-rateWidth(200)));
    }];
}

@end
